package com.xmfh.wemedia.service.impl;

import com.xmfh.wemedia.mapper.DdCommentMapper;
import com.xmfh.wemedia.service.IDdCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Auther: 胡桃
 * @Date: 2022/4/8 22:25
 * @Description: com.xmfh.wemedia.service.impl
 * @version: 1.0
 */
@Service
public class IDdCommentServiceImpl implements IDdCommentService {
    @Autowired
    private DdCommentMapper commentMapper;

    @Override
    public int addCommentCount(String commentType, Integer id) {
        if ("article".equals(commentType)) {
            commentType = "dd_article";
        }
        if ("album".equals(commentType)) {
            commentType = "dd_album";
        }
        if ("micro".equals(commentType)) {
            commentType = "dd_micro";
        }
        if ("question".equals(commentType)) {
            commentType = "dd_question";
        }
        return commentMapper.updateCommentCount(commentType, id);
    }
}
